//
//  HongBaoQueue.m
//  WeChatRedbag
//
//  Created by 卖女孩的小火柴 on 2021/12/23.
//


#import "HongBaoQueue.h"
@interface HongBaoQueue()
@property(nonatomic,strong)NSMutableArray* queuearray;
@end
@implementation HongBaoQueue
static HongBaoQueue *honbaoqueue = nil;
+(instancetype)shareQueue{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        honbaoqueue=[[HongBaoQueue alloc]init];
    });
    return honbaoqueue;
}

-(instancetype)init{
    if(self=[super init]){
        _queuearray=[[NSMutableArray alloc]init];
    }
    return self;
}

-(void)AddToQueue:(NSMutableDictionary*)dic{
    [self.queuearray addObject:dic];
}

-(NSMutableDictionary*)getFromQueue{
    if([self.queuearray count]==0||![self.queuearray firstObject]){
        return nil;
    }
    NSMutableDictionary* mydic=[self.queuearray firstObject];
    [self.queuearray removeObjectAtIndex:0];
    return mydic;
}
@end
